Skip to content

Netlist Writer: write post synthesis netlist that can be simulated #1957

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

lpawelcz
Copy link
Contributor

This PR is a work in progress. It relies on code from 3 different PRs:

That is why it's based on top of concatenated commits from all 3 PRs. This will cause those commits to appear on the list of commits in this PR and in the diff. I will update this PR when the rest of PRs will be merged.

Description

This PR modifies the VPR Netlist Writer in order to allow writing Verilog and SDF files that can be simulated. The changes include:

  • changing the access specifiers of some members of class NetlistWriterVisitor from private to protected
  • adding class MergedNetlistWriterVisitor that inherits from NetlistWriterVisitor and overrides some of its behaviour in order to write another verilog netlist that will have its multi-bit top module ports merged so that we have code like this:
module top (
    input \clk ,
    output [3:0] led);

instead of this:

module top (
    input \clk ,
    output \led[0] ,
    output \led[1] ,
    output \led[2] ,
    output \led[3] 
);
  • adding new option --gen_post_synthesis_merged_netlist that enables second verilog writer
  • changing the format of multi-bit ports in cells instancing
  • escaping characters [ and ] in Black Box cell instancing in SDF files

Related Issue

Issue was first described in #1946.

Motivation and Context

This change is required for performing simulation of post synthesis verilog files written by VPR without using any external scripts for adjusting VPR output. Simulations are part of Symbiflow testing procedure where verilog files with merged multi-bit ports of at least the top module are needed.

How Has This Been Tested?

New VPR build was used to generate verilog output for Symbiflow designs that were then simulated to verify the correctness of verilogs

Types of changes

  • Bug fix (change which fixes an issue)
  • New feature (change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

@github-actions github-actions bot added the VPR VPR FPGA Placement & Routing Tool label Jan 25, 2022
@lpawelcz lpawelcz force-pushed the pcza/merge-verilog-ports branch from 97ce5f6 to acbde85 Compare March 28, 2022 09:18
Change access specifiers from private to protected
for some members of NetlistWriterVisitor to make those visible
in class that will derive from the visitor.

Signed-off-by: Pawel Czarnecki <[email protected]>
@lpawelcz lpawelcz force-pushed the pcza/merge-verilog-ports branch 2 times, most recently from c2ee265 to 1c6150c Compare April 6, 2022 12:57
@lpawelcz lpawelcz marked this pull request as ready for review April 6, 2022 12:57
@lpawelcz lpawelcz changed the title [WIP]: Netlist Writer: write post synthesis netlist that can be simulated Netlist Writer: write post synthesis netlist that can be simulated Apr 6, 2022
@lpawelcz lpawelcz force-pushed the pcza/merge-verilog-ports branch from 1c6150c to 7952b53 Compare April 6, 2022 16:44
@lpawelcz lpawelcz requested review from acomodi and vaughnbetz April 7, 2022 08:06
Copy link
Collaborator

@acomodi acomodi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, I believe that @vaughnbetz had some comments regarding the naming of the --post_synthesis_netlist step which might need to be changed to something else, e.g. --post_implementation_netlist or similar, as it happens after the whole place and route stages.

Copy link
Contributor

@vaughnbetz vaughnbetz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Just suggest changing the name thoughout from post_synthesis to post_implementation; also have a few minor commenting suggestions and fixes.

@@ -1254,6 +1254,14 @@ Analysis Options

**Default:** ``off``

.. option:: --gen_post_synthesis_merged_netlist { on | off }

This option is based on ``--gen_post_synthesis_netlist``.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: "a single verilog file"
I think we should change the name to --gen_post_implementation_netlist, as @acomodi suggests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed typo and renamed option

This option is based on ``--gen_post_synthesis_netlist``.
The difference is that ``--gen_post_synthesis_merged_netlist`` generates only single verilog file with merged top module multi-bit ports of the implemented circuit.
The name of the file is ``<basename>_merged_post_synthesis.v``

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably rename the output file to _post_implementation.v

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -623,6 +623,7 @@ static void SetupAnalysisOpts(const t_options& Options, t_analysis_opts& analysi
}

analysis_opts.gen_post_synthesis_netlist = Options.Generate_Post_Synthesis_Netlist;
analysis_opts.gen_post_synthesis_merged_netlist = Options.Generate_Post_Synthesis_Merged_Netlist;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name -> post_implementation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -2099,6 +2120,187 @@ class NetlistWriterVisitor : public NetlistVisitor {
struct t_analysis_opts opts_;
};

/**
* @brief A class which writes post-synthesis merged netlists (Verilog)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

post synthesis --> post implementation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@@ -2124,6 +2326,23 @@ void netlist_writer(const std::string basename, std::shared_ptr<const AnalysisDe
nl_walker.walk();
}

///@brief Main routing for this file. See netlist_writer.h for details.
void merged_netlist_writer(const std::string basename, std::shared_ptr<const AnalysisDelayCalculator> delay_calc, struct t_analysis_opts opts) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "Main routing" should be "Main routine"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed typo

@@ -208,6 +208,7 @@ struct t_options {
/* Analysis options */
argparse::ArgValue<bool> full_stats;
argparse::ArgValue<bool> Generate_Post_Synthesis_Netlist;
argparse::ArgValue<bool> Generate_Post_Synthesis_Merged_Netlist;
argparse::ArgValue<int> timing_report_npaths;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment: post_synthesis -> post_implementation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed

@lpawelcz lpawelcz force-pushed the pcza/merge-verilog-ports branch from b003083 to c17f3dd Compare April 11, 2022 08:22
@lpawelcz
Copy link
Contributor Author

lpawelcz commented Apr 11, 2022

@acomodi, @vaughnbetz - thanks for the reviews! I've renamed all occurrences of post_synthesis_merged_netlist (and similar) to post_implementation_merged_netlist and fixed all typos that were pointed out.

Signed-off-by: Paweł Czarnecki <[email protected]>
@lpawelcz lpawelcz force-pushed the pcza/merge-verilog-ports branch from c17f3dd to 12830cd Compare April 11, 2022 10:22
protected:
/**
* @brief Returns the name of a wire connecting a primitive and global net.
*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does global net mean in this context? Just a net that is routed? (I'm guessing that).

Or an actual global (often not routed, on a special network) net?

Would be good to clarify.

@vaughnbetz
Copy link
Contributor

Looks good to me.
A couple of clean up things that would be good to do after merge.

  1. What is a global net in the netlister_writer.cpp comment (see my note above)?
  2. Would be good to update the gen_post_synthesis_netlist option, and any related options, to gen_post_implementation_netlist (new name) too.

@vaughnbetz vaughnbetz merged commit 829c06d into verilog-to-routing:master Apr 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
VPR VPR FPGA Placement & Routing Tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants